package com.nidu.demo.post.convertor;

import com.nidu.demo.base.BaseConvertor;
import com.nidu.demo.convertor.MapStructConfig;
import com.nidu.demo.post.dto.PositionCO;
import com.nidu.demo.post.mapper.dataobject.PositionDO;
import com.nidu.demo.post.model.Position;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

/**
 * 职位转换器
 *
 * @author auto
 */
@Mapper(config = MapStructConfig.class)
public interface PositionConvertor extends BaseConvertor<PositionDO, Position, PositionCO> {
    
    @Override
    @Mapping(target = "createTime", ignore = true)
    @Mapping(target = "updateTime", ignore = true)
    @Mapping(target = "createBy", ignore = true)
    @Mapping(target = "updateBy", ignore = true)
    @Mapping(source = "postName", target = "name")
    @Mapping(source = "postCode", target = "code")
    PositionDO toDataObject(Position post);

    @Override
    @Mapping(source = "name", target = "postName")
    @Mapping(source = "code", target = "postCode")
    Position toDomainObject(PositionDO dataObject);
} 